//
//  WXViolationDetailsTableViewController.m
//  CarJX
//
//  Created by jxcl on 14-9-17.
//  Copyright (c) 2014年 KK. All rights reserved.
//

#import "WXViolationDetailsTableViewController.h"
#import "UIViewController+HttpRequest.h"
//violationDetail
// details

@interface WXViolationDetailsTableViewController ()
@property (weak, nonatomic) IBOutlet UITableViewCell *fakuanCell;
@property (nonatomic , retain) NSDictionary *violationDic;

@end

@implementation WXViolationDetailsTableViewController

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

/*
  violationTime;
  violationPlace;
  price;
  points;
  violationCode;
  violationNum;
  collectionAgencies;
  IllegalContent;
 */

- (void)viewDidLoad
{
    [super viewDidLoad];
    _agenciesLabel.editable = NO;
    _violationContent.editable = NO;
    
    [self setTitle:self.carNum];
    if ([self.identity isEqualToString:@"登陆"]) {
        [self GETWithContentType:@"imiviolationdetial" params:@{@"violation_id" : _violationID} success:^(ResultMy *result) {
            
            NSLog(@"%@",result.dictionaryInfo);
            
            _violationDic = [result.dictionaryInfo objectForKey:@"violationdetial"];
            
            _violationTime.text = [_violationDic objectForKey:@"TIME"];
            _violationPlace.text = [@"违章地点:"  stringByAppendingString:[_violationDic objectForKey:@"ADDRESS"]] ;
            _violationPlace.font = [UIFont systemFontOfSize:17];
            _price.text = [_violationDic objectForKey:@"PRICE"];
            _points.text = [_violationDic objectForKey:@"SCORE"];
            _violationCode.text = [_violationDic objectForKey:@"LEGALNUM"];
            _violationNum.text = [_violationDic objectForKey:@"NUMBER"];
            
            _agenciesLabel.text =  [@"采集机构:" stringByAppendingString:[_violationDic objectForKey:@"AGENCY"]];
            _agenciesLabel.font = [UIFont systemFontOfSize:17];
            _violationContent.text = [@"违章内容:" stringByAppendingString:[_violationDic objectForKey:@"CONTENT"]];
            _violationContent.font = [UIFont systemFontOfSize:17];
            
            
            [self.tableView reloadData];
            
        } failure:^(NSError *error) {
            
        }];

    }else if ([self.identity isEqualToString:@"未登陆"]){
        _violationTime.text = [_weiZhangDicInfo objectForKey:@"time"];
        _violationPlace.text = [@"违章地点:"  stringByAppendingString:[_weiZhangDicInfo objectForKey:@"address"]] ;
        _violationPlace.font = [UIFont systemFontOfSize:17];
        _price.text = [_weiZhangDicInfo objectForKey:@"price"];
        _points.text = [_weiZhangDicInfo objectForKey:@"score"];
        _violationCode.text = [_weiZhangDicInfo objectForKey:@"legalnum"];
        _violationNum.text = [_weiZhangDicInfo objectForKey:@"number"];
        
        _agenciesLabel.text =  [@"采集机构:" stringByAppendingString:[_weiZhangDicInfo objectForKey:@"agency"]];
        _agenciesLabel.font = [UIFont systemFontOfSize:17];
        _violationContent.text = [@"违章内容:" stringByAppendingString:[_weiZhangDicInfo objectForKey:@"content"]];
        _violationContent.font = [UIFont systemFontOfSize:17];
        [self.tableView reloadData];
        
    }
    
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
 }





/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
